package com.ny529;

import java.util.HashMap;

public class Map {
    private Map<Integer, Employee> employeeMap;

    public EmployeeMapManagement() {
        employeeMap = new HashMap<>();
    }

    // 添加员工信息
    public void addEmployee(Employee employee) {
        employeeMap.put(employee.getId(), employee);
    }

    // 查询员工信息
    public Employee findEmployeeById(int id) {
        return employeeMap.get(id);
    }

    // 删除员工信息
    public void deleteEmployee(int id) {
        employeeMap.remove(id);
    }

    // 修改员工信息
    public void updateEmployee(Employee updatedEmployee) {
        if (employeeMap.containsKey(updatedEmployee.getId())) {
            employeeMap.put(updatedEmployee.getId(), updatedEmployee);
        }
    }

    // 删除所有员工信息
    public void deleteAllEmployees() {
        employeeMap.clear();
    }
}
